package com.air.ota.service.imp;

import java.util.List;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.air.common.service.imp.BaseServiceImp;
import com.air.common.util.QueryCondition;
import com.air.common.util.QueryExpression;
import com.air.ota.dao.CardSequenceDao;
import com.air.ota.mo.CardSequence;
import com.air.ota.service.ICardSequenceService;

@Service("cardSequenceService")
public class CardSequenceServiceImp extends BaseServiceImp implements
		ICardSequenceService, InitializingBean {

	
	@Autowired
	CardSequenceDao cardSequenceMapper;
	
	@Override
	public CardSequence findByPhoneNum(String phoneNum) throws Exception {
		
		QueryCondition condition =new QueryCondition();
		condition.addQueryCondition("phoneNumber", phoneNum, QueryExpression.EQUALS);
		
		List<CardSequence> result=this.queryByCondition(condition);
		if (result == null||result.size()==0){
			return null;
		}
		
		return result.get(0);
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		this.baseDao = cardSequenceMapper;
	}

}
